package com.jl.jlapp.mvp.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter.OnItemChildClickListener;
import com.jl.jlapp.R;
import com.jl.jlapp.adapter.CouponCenterAdapter;
import com.jl.jlapp.eneity.AllAvailableCouponModel;
import com.jl.jlapp.eneity.CommitVatInvoiceAptitudeToCheckModel;
import com.jl.jlapp.nets.CommonObserver;
import com.jl.jlapp.nets.Net;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class CouponCenterActivity
  extends AppCompatActivity
{
  CouponCenterAdapter couponCenterAdapter;
  @BindView(R.id.lrv_discount_list)
  RecyclerView lrvDiscountList;
  @BindView(R.id.no_coupon_show)
  RelativeLayout noCouponShow;
  List<AllAvailableCouponModel.ResultDataBean> resultDataBeanList = new ArrayList();
  int userId = 0;
  
  private void getNetData()
  {
    Net.get().getAllAvailableCoupon().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
            .subscribe(new CommonObserver<AllAvailableCouponModel>() {
              @Override
              protected void onError(String errorMsg) {

              }

              @Override
              protected void onSuccess(AllAvailableCouponModel allAvailableCouponModel) {

              }
            });
  }
  
  private void setActivityNameCouponListAdapter()
  {
    this.lrvDiscountList.setLayoutManager(new LinearLayoutManager(this));
    this.couponCenterAdapter = new CouponCenterAdapter(R.layout.item_coupon, this.resultDataBeanList);
    this.lrvDiscountList.setAdapter(this.couponCenterAdapter);
    this.couponCenterAdapter.setOnItemChildClickListener(new OnItemChildClickListener()
    {
      public void onItemChildClick(BaseQuickAdapter paramAnonymousBaseQuickAdapter, View paramAnonymousView, int paramAnonymousInt)
      {
        paramAnonymousInt = ((AllAvailableCouponModel.ResultDataBean)CouponCenterActivity.this.resultDataBeanList.get(paramAnonymousInt)).getId();
        Net.get().userGetCoupon(paramAnonymousInt, CouponCenterActivity.this.userId)
                .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CommonObserver<CommitVatInvoiceAptitudeToCheckModel>() {
                  @Override
                  protected void onError(String errorMsg) {

                  }

                  @Override
                  protected void onSuccess(CommitVatInvoiceAptitudeToCheckModel commitVatInvoiceAptitudeToCheckModel) {

                  }
                });
      }
    });
  }
  
  @OnClick({R.id.return_btn})
  public void onClick(View paramView)
  {
    finish();
  }
  
  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(R.layout.activity_coupon_center);
    ButterKnife.bind(this);
    this.userId = getSharedPreferences("JLAppData", 0).getInt("userId", 0);
    getNetData();
  }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/mvp/activity/CouponCenterActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */